<?php

namespace HuangYi\Rbac\Tests\Models;

use HuangYi\Rbac\Tests\TestCase;
use Illuminate\Support\Facades\Config;

abstract class ModelTestCase extends TestCase
{
    /**
     * Defines model class.
     *
     * @return string
     */
    abstract protected function model();

    /**
     * Creates model instance.
     *
     * @return \Illuminate\Database\Eloquent\Model
     */
    protected function createModel()
    {
        $model = $this->model();

        return new $model;
    }

    public function testUuid()
    {
        Config::shouldReceive('get')->once()->with('rbac.key_type')->andReturn('uuid');

        $model = $this->createModel();

        $this->assertEquals('uuid', $model->getKeyType());
        $this->assertFalse($model->incrementing);
    }
}
